#ifndef GLOBALS_H
#define GLOBALS_H

#include <cmath>

namespace libsgp4
{

const double kAE = 1.0;//地球赤道半径的标准化值
const double kQ0 = 120.0;//
const double kS0 = 78.0;//
const double kMU = 398600.8;//地心引力常数，e8m^3/s^2,或可修正为398600.4
const double kXKMPER = 6378.135;//地球赤道半径的实际值，km
const double kXJ2 = 1.082616e-3;
const double kXJ3 = -2.53881e-6;
const double kXJ4 = -1.65597e-6;//J2、J3和J4都是与地球纬度有关的带谐系数，为了对地球非球形进行精确地建模，这3个系数都要考虑。

/*
 * alternative XKE
 * affects final results
 * aiaa-2006-6573
 * const double kXKE = 60.0 / sqrt(kXKMPER * kXKMPER * kXKMPER / kMU);
 * dundee
 * const double kXKE = 7.43669161331734132e-2;
 * 上为替代定义，会影响最终结果
 */
const double kXKE = 60.0 / sqrt(kXKMPER * kXKMPER * kXKMPER / kMU);
const double kCK2 = 0.5 * kXJ2 * kAE * kAE;
const double kCK4 = -0.375 * kXJ4 * kAE * kAE * kAE * kAE;

/*
 * alternative QOMS2T
 * affects final results
 * aiaa-2006-6573
 * #define QOMS2T   (pow(((Q0 - S0) / XKMPER), 4.0))
 * dundee
 * #define QOMS2T   (1.880279159015270643865e-9)
 */
const double kQOMS2T = pow(((kQ0 - kS0) / kXKMPER), 4.0);

const double kS = kAE * (1.0 + kS0 / kXKMPER);
const double kPI = 3.14159265358979323846264338327950288419716939937510582;//派π
const double kTWOPI = 2.0 * kPI;
const double kTWOTHIRD = 2.0 / 3.0;
const double kTHDT = 4.37526908801129966e-3;//可能是用于特定时间计算的修正值。
/*
 * earth flattening
 */
const double kF = 1.0 / 298.26;//地球扁平率，描述地球赤道半径与极半径之间的差异
/*
 * earth rotation per sideral day
 */
const double kOMEGA_E = 1.00273790934;//地球自转的恒星日角速度
const double kAU = 1.49597870691e8;//地球到太阳的平均距离

const double kSECONDS_PER_DAY = 86400.0;
const double kMINUTES_PER_DAY = 1440.0;
const double kHOURS_PER_DAY = 24.0;//规定每日的秒、分、时

const double kA3OVK2 = -kXJ3 / kCK2 * kAE * kAE * kAE;

} // namespace libsgp4
#endif // GLOBALS_H
